<?php

use yii\helpers\Html;
use common\core\ActiveForm;
use kartik\select2\Select2;
use \yii\web\JsExpression;

/* @var $this yii\web\View */
/* @var $model backend\models\JjrProjectHouse */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="jjr-project-house-form">

    <?php $form = ActiveForm::begin(); ?>

    <?=$form->field($model, 'jjr_project_id')->label('项目名称')->widget(Select2::classname(), [
        'initValueText' => $text,
        'options' => ['placeholder' => '请输入项目进行搜索'],
        'pluginOptions' => [
            'ajax' => [
                'url' => $searchUrl,
                'dataType' => 'json',
                'data' => new JsExpression('function(params) { return {q:params.term}; }')
            ],
            'templateResult' => new JsExpression('function(res) { return res.text; }'),
            'templateSelection' => new JsExpression('function (res) { return res.text; }'),
        ]]); ?>
    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'area')->textInput() ?>

<!--     $form->field($model, 'type')->dropDownList([''=>'请选择','H' => 'H','I' => 'I', 'J'=>'J','K'=>'K','L'=>'L','M'=>'M']) -->
    <?= $form->field($model, 'type')->textInput() ?>
    <?= $form->field($model, 'price')->textInput() ?>
    <?= $form->field($model, 'management_type')->textInput() ?>
    <?= $form->field($model, 'struct')->textInput() ?>
    <?= $form->field($model, 'direction')->textInput() ?>
    <?= $form->field($model, 'deal_limit')->textInput() ?>
    <?= $form->field($model, 'open_limit')->textInput() ?>
    <!-- 单图 -->
    <?=$form->field($model, 'main_pic')->widget('\common\widgets\images\Images',[
        //'type' => \backend\widgets\images\Images::TYPE_IMAGE, // 单图
        'saveDB'=>1, //图片是否保存到picture表，默认不保存
    ],['class'=>'c-md-12'])->label('户型图片')->hint('单图推荐图片尺寸为：800*600');?>

    <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'advantage')->textarea() ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
